//
//  ButtonRoleView.swift
//  SwiftUIButton
//
//  Created by 李煜 on 2024/7/30.
//

import SwiftUI

struct ButtonRoleView: View {
    var body: some View {
        VStack {
            // iOS 15  API
            Button("Delete", role: .destructive) {
                print("Delete")
            }
            //醒目样式borderedProminent iOS 15
            .buttonStyle(.borderedProminent)
            .controlSize(.extraLarge)

            Button("Delete", role: .destructive) {
            }
            .buttonStyle(.bordered)

            Button("Cancel", role: .cancel) {
            }
            .buttonStyle(.borderedProminent)
            Button("Cancel", role: .cancel) {
            }
            .buttonStyle(.bordered)
          
          Button(role: .destructive) {
            print("todo")
          } label: {
            Label(
              title: { Text("Label") },
              icon: { Image(systemName: "figure.walk") }
            )
          }
          .tint(.orange)
          .buttonBorderShape(.capsule)
          .buttonStyle(.borderedProminent)
          .controlSize(.extraLarge)
        }
    }
}

#Preview {
    ButtonRoleView()
}
